var scripts = [null, null];
$('.page-content-area').ace_ajax('loadScripts', scripts, function() {

	jQuery(function($) {
	
		var basePath = app.contextPath;
		var apiPath = app.apiContextPath;

		var formSettings = {
			// 主键字段
			pkField: "id",
			// ID前缀
			prefixId: "Tables",
			// 接口地址前缀
			apiPathPrefix: apiPath,
			// 服务端获取表单元素
			serverElement: true,
			// 请求地址
			modularPath: {
				editUrl: "/grid-edit.json",
				insertUrl: "/grid-insert.json",
				updateUrl: "/grid-update.json",
				ajsxElement: "/grid-element.json",
			},
			// 表单元素配置
			FormOption: [
				{id:'id',type:"hidden"},
				{id:'id1',title:'序号1',type:"text",tooltip:"",rules:{required:true}},
				{id:'id2',title:'序号2',type:"text",disabled:true},
				{id:'id3',title:'序号3',type:"text",readonly:true},
				{id:'id4',title:'序号4',type:"text",value:"1111",editType:'disabled'},
				{id:'password',title:'密码',type:"password",editType:'hidden',rules:{required:false,minlength:5}},
				{id:'Domain',title:'域名',field:'Domain',type:"text",className:"input-small",value:'',placeholder:"域名",editType:'',disabled:false,readonly:false,tooltip:"tooltip1",rules:{required:true},messages:{required:"请必填该字段"}},
				{id:'date',title:'日期',type:"datetime",format:"YYYY-MM-DD",value:'2018-02-23'},
				{id:'datetime',title:'时间',type:"datetime",format:"YYYY-MM-DD HH:mm:ss",disabled:false,readonly:false,tooltip:"tooltip2",rules:{required:true}},
				{id:'time',title:'时刻',type:"datetime",format:"hh:mm:ss"},
				{id:'sex',title:'性别',type:"select",value:'1',placeholder:"请选择...",fieldKey:"sex",fieldValue:"sexName",data:[{sex:1,sexName:"男"},{sex:2,sexName:"女"}],editType:'hidden'},
				{id:'sexId',title:'单选',type:"select",value:'',data:{"1":"男","2":"女"},disabled:false,readonly:false,tooltip:"tooltip3",rules:{required:true}},
				{id:'DomainId',title:'多选',field:'DomainId[]',type:"select",value:"",multiple:true,fieldKey:"id",fieldValue:"Domain",data:"/Tables/grid.json",dataParam:{},dataSrc:"result"},
				{id:'text',title:'文本',type:"textarea",disabled:false,readonly:false,tooltip:"tooltip4",rules:{required:true}},
				{id:'fileUpload',title:'上传',type:"file",multiple:true,fileOption:{maxSize:110000},disabled:false,readonly:false,tooltip:"tooltip5",rules:{required:true}},
				{id:'kindEditor',title:'富文本',type:"editor",rules:{required:true}},
				{id:'treeview',title:'树形列表',type:"treeview",value:"",multiple:true,fieldKey:"id",fieldValue:"Domain",data:"/Tables/grid-tree.json",dataParam:{},dataSrc:"result"},
				{id:'moveSelect',title:'移动选择',field:'moveSelect[]',type:"moveselect",value:"",multiple:true,fieldKey:"id",fieldValue:"Domain",data:{"1":"option 1","2":"option 2","3":"option 3","4":"option 4","5":"option 5","6":"option 6"},ddataParam:{},dataSrc:"result"},
				{}
			],
		};
		var _TablesForm = $('#TablesForm').form(formSettings);
		window.TablesForm = _TablesForm.data('form');

	});
});

